﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Xxf.IISM.Core;

namespace Xxf.IISM.Web.Controllers
{
    public class AdminController : AdminControllerBase
    {
        // GET: Admin
        public ActionResult Index()
        {
            return View();
        }
        [AllowAnonymous]
        [HttpGet]
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            return View();
        }
        [AllowAnonymous]
        [HttpPost]
        public ActionResult Login(UserInfo userInfo,string returnUrl)
        {
            if (!string.IsNullOrWhiteSpace(userInfo.UserName))
            {
                Session[AppConfig.UserSessionName] = userInfo;
                return RedirectToAction(returnUrl);
            }else
            {
                return View();
            }
        }
        public ActionResult LayoutTable()
        {
            return View();
        }
        public JsonResult TableData()
        {
            List<object> m = new List<object>();
            for (int i = 0; i < 100; i++)
            {
                var d = new { name = "1" , position =i, salary = "salary", start_date= "start_date"+i, office= DateTime.Now, extn=DateTime.Now };
                m.Add(d);
            }
            
            return Json(new {data=m ,draw=1, recordsTotal =200, recordsFiltered =30} );
        }
    }
}